package com.silence.gankio.adapter

import android.bluetooth.BluetoothDevice
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.silence.gankio.R

class BluetoothAdapter(data: MutableList<BluetoothDevice>?) :
    BaseQuickAdapter<BluetoothDevice, BaseViewHolder>(R.layout.item_bluetooth, data) {
    override fun convert(helper: BaseViewHolder, item: BluetoothDevice) {
        val deviceName: String? = item.name
        if ((deviceName != null)) {
            helper.setText(R.id.tv_name, "设备名称: $deviceName")
        } else{
            helper.setText(R.id.tv_name, "未知设备")
        }
        helper.setText(R.id.tv_mac, "Mac地址为: ${item.address}")
    }
}